<!DOCTYPE html>
{% load myfilter  %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文章管理</title>
    <link rel="stylesheet" href="{% static 'common/css/table.css' %}"/>

    <script>
        function is_confirm(href) {
            let c = confirm("该操作不可逆！确定操作吗?")
            if(c){
                window.location.href = href
            }
        }
    </script>
</head>
<body>
    {% include "inc/top.html" with title='文章列表' %}
    <table class="mytable">
        <tr>
            <td>
                {% include "topic/inc.html" %}
            </td>
        </tr>
    </table>
    <table class="mytable mytable_hover">
        <thead>
            <tr>
                <td>标识</td>
                <td>标题</td>
                <td>创建日期</td>
                <td>发布日期</td>
                <td>作者</td>
                <td>所属栏目</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            {% for t in ts %}
                <tr>
                    <td>{{ t.id }}</td>
                    <td><a href="{% url 'topic.show' id=t.id %}">{{ t.title }}</a></td>
                    <td>{{ t.create_date }}</td>
                    <td>{{ t.release_date }}</td>
                    <td>{{ t.author }}</td>
                    <td>{{ t.category.name }}</td>
                    <td>
                        <a href="javascript:is_confirm('{% url 'topic.delete' id=t.id %}')">删除</a>
                        <a href="{% url 'topic.update' id=t.id %}">修改</a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</body>
</html>